{
Function:       _DateTimeOffset

Description:    Determine the offset of a bar with specified date and time.

                Returns -1 if no bar with specified date and time found.

Author:         MarkSanDiego

Updated:        09/01/09    original version
                09/07/10    add result = -1 if no bar matching specified date and time found


Usage:

    value1 = _DateTimeOffset(Date, Time);

}

inputs:
    int BarDate(NumericRef),
    int BarTime(NumericRef);

vars: 
    intrabarpersist int n(0),
    intrabarpersist int offset(0);

    offset = MaxBarsBack;
    for n = 0 to MaxBarsBack begin
        if Date[n] = BarDate and Time[n] = BarTime then begin 
            offset = n; 
            break;
        end;
    end;

    if offset = MaxBarsBack then 
        _DateTimeOffset = -1            { no bar with specified time date found }
    else
        _DateTimeOffset = offset;